package com.doit.common.util

/**
  * Created by hunter.coder 涛哥  
  * 2019/5/6 9:30
  * 交流qq:657270652
  * Version: 1.0
  * 更多学习资料：https://blog.csdn.net/coderblack/
  * Description:
  **/
object CollectionUtil {

  /**
    * 合并两个map，相同key的value累加
    * @param tagMap1
    * @param tagMap2
    * @return
    */
  def mergeMap(m1: Map[String, Double], m2: Map[String, Double]): Map[String, Double] = {
    (m1 /: m2) {
      case (map, (k, v)) =>
        map + (k -> (v + map.getOrElse(k, 0d)))
    }
  }

}
